﻿using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sustainalytics.Synchronization.Interface;
using Sustainalytics.Entities.ConnectionStrings;

namespace Sustainalytics.Universes.Synchronization.Tests
{
    [TestClass()]
    public class AssureFeatureUniversesSyncStepTests
    {


        [TestMethod()]
        public void AssureFeatureUniversesSyncStepTest()
        {
            // set up 
            var context = new SyncContext(ErrorPolicy.BreakRightAway);
            context.IsInitialSync = true;
            context.Status = SyncOperationStatus.Failed;
            context.Token = new CancellationToken();
            context.GAConnectionStrings = new Dictionary<string, string>();
            context.CompanyUniverses = new Dictionary<Guid, List<int>>();
            context.Report = new System.Collections.Concurrent.ConcurrentBag<string>();
            var step = new AssureFeatureUniversesSyncStep();

            // set up db
            context.GAConnectionStrings[ConnectionStringType.ClientDW.ToString()]        = "mongodb://localhost:27017/ClientDW_A";
            context.GAConnectionStrings[ConnectionStringType.GovernanceDW.ToString()]    = "mongodb://localhost:27017/GovernanceDW_A";
            context.GAConnectionStrings[ConnectionStringType.ClientUniverses.ToString()] = "mongodb://localhost:27017/ClientUniverses_A";


            var resultContext = step.Start(context);
            Assert.IsTrue(resultContext.Status == SyncOperationStatus.Succeeded);
        }
    }
}
